<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>继承person类的子类</title>
	</head>
	<body>
		<div id="exam"></div>
	</body>
	
	<script type="text/javascript">
		
		function Person(name,chinese,math){
			this.name=name;
			this.chinese=chinese;
			this.math=math;
			this.getname=function(){
				return this.name;
			}
			this.getchinese=function(){
				
				return this.chinese;
			}
			this.getmath=function(){
				
				return this.math;
			}
			
		}
		function Student(age){
             this.age=age;
		}
		Student.prototype=new Person();
		Student.prototype.getage=function(){
			return this.age;
		}
		var zhang=new Student("25");
		zhang.name="张三";
		zhang.chinese=98;
		zhang.math=80;
		var ssr="姓名："+zhang.getname()+"<br/>"+
		"语文："+zhang.getchinese()+"<br/>"+
		"数学："+zhang.getmath()+"<br/>"+
		"年龄："+zhang.getage();
		document.getElementById("exam").innerHTML=ssr;
		
		
	</script>
</html>
